<?php			
/**
 * @version		$Id: birts.php 2011.08.11 thierry $
 * @package		admin.nodels
 * @subpackage	com_projid
 * @copyright	Copyright (C) 2011 Pojid All rights reserved.
 * @license		GNU General Public License version 2 or later; see LICENSE.txt
 */
defined('_JEXEC') or die('Restricted access');
jimport('joomla.application.component.modellist');

class ProjidModelBirts extends JModelList
{
	/**
	 * Method to build an SQL query to load the list data.
	 *
	 * @return	string	An SQL query
	 */
	protected function getListQuery() 
	{
		// Create a new query object.
		$db = JFactory::getDBO();
		$query = $db->getQuery(true);

		// Select some fields
		$query->select('id_birt,birt_name');
		// From the hello table
		$query->from('#__projid_birt');
		
		return $query;
	}
	
public function getParams()
	{

        $db = JFactory::getDBO();
		$query = $db->getQuery(true);

		// Select some fields
		$query->select('id_birt,param_name');
		// From the hello table
		$query->from('#__projid_birt');
		$query->leftjoin('#__projid_report_param  on #__projid_birt.id_birt=#__projid_report_param.report_id');
		$query->leftjoin('#__projid_birt_parameter  on #__projid_report_param.param_id=#__projid_birt_parameter.id_param');
		//$query->where('#__projid_report_param.report_id=#__projid_birt.id_birt');
		
        $items  = $this->_getList((string) $query, $this->getState('list.start'), $this->getState('list.limit'));
 
        // Check for a database error.
        if ($this->_db->getErrorNum()) {
                $this->setError($this->_db->getErrorMsg());
                return false;
        }
 
 return $items;


}
}